<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
     
    <div>
        <input type="text" id="input1">
    </div>

    <script>
        
        const input1 = document.getElementById('input1')

        function debounce ( fn , delay = 500 ) {

            let timer = null

            return function () {
                if( timer ){
                    clearTimeout( timer )
                }

                timer = setTimeout( () => {

                    fn.apply( this , arguments )
        
                    timer = null
                    
                } , delay )
            }

        }

        input1.addEventListener( 'keyup' , debounce ( function () {
            console.log(input1.value)
        } , 600 ) )

    </script>
</body>
</html>